//
//  SelePayOrderTableViewCell.swift
//  ZNZXSuperMarket
//
//  Created by 四川中农 on 2018/8/23.
//  Copyright © 2018年 四川中农. All rights reserved.
//

import UIKit

class SelePayOrderTableViewCell: UITableViewCell {
    
    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var rightLabel: UILabel!
    

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    func updateViews(title:String,rightString:String,isPrice:Bool){
        self.titleLabel.text = title
        if isPrice {
            var attribute = NSMutableAttributedString.init(string: "￥" + rightString)
            attribute.addAttributes([NSAttributedStringKey.font:UIFont.systemFont(ofSize: 11)], range: NSString.init(string: "￥" + rightString).range(of: "￥" + rightString))
            attribute = NSMutableAttributedString.init(attributedString: attribute)
            attribute.addAttributes([NSAttributedStringKey.font:UIFont.systemFont(ofSize: 17)], range: NSString.init(string: "￥" + rightString).range(of: rightString.getPriceInteger()))
            attribute = NSMutableAttributedString.init(attributedString: attribute)
            attribute.addAttributes([NSAttributedStringKey.foregroundColor:UIColor.init(hexColor: "#ed4848")], range: NSString.init(string: "￥" + rightString).range(of: "￥" + rightString))
            self.rightLabel.attributedText = attribute
        }else{
            self.rightLabel.text = rightString
        }
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
